﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GrouponDesktop.AbmProveedor
{
    public partial class AltaProvee : Form
    {
        public AltaProvee()
        {
            InitializeComponent();
            BDConnection.FillComboBox(cb_ciudad, "select ciudad from CodingSpree.TL_CIUDADES");
        }

        private void button1_Click(object sender, EventArgs e)
        {

            string user_name = this.tb_rs.Text;
            string password = Funciones.ImprimirHash(user_name);

            BDConnection.execute("EXEC CodingSpree.insertUser '" + this.tb_rs.Text + "', '" + password + "', " + 2);

            string query = "EXEC CodingSpree.insertProve '";
            query = query + this.tb_rs.Text + "','";

            string dom = this.textBox10.Text + " " + this.textBox9.Text + " " + this.textBox8.Text + " " + this.textBox7.Text;
            query = query + dom + "', '";

            query = query + this.cb_ciudad.Text + "', ";
            query = query + this.textBox6.Text + ", '";
            query = query + this.textBox12.Text + "','";
            query = query + this.textBox13.Text + "'";

            BDConnection.execute(query);


            MessageBox.Show("Alta Efectuada");
        }
    }
}
